/***2024-11-20 迷途小羔羊
 * 用于编写角色顶部的进度条显示（如血条）
*/
namespace ghost
{
    export class BarEffect extends RoleEffect implements IResource
    {
        
        public getDefaultSortId():number
        {
            return RoleEffectSortID.HPBAR;
        }
        protected effectCreate():void
        {
            let s = this;
            let objID:string;
            let hpEffect:BarObj;
            objID = s._param.objID;
			if (objID == null) {				
				s.dispose();
				return;
			}
			hpEffect = <BarObj>s._effect;
			if (hpEffect) {
				let cfg: any;
				if (hpEffect.cfg.roleID != objID) {
					cfg = RoleConfig.getObjConfig(objID);
					hpEffect.parseConfig(cfg.roleType, cfg);
					hpEffect.resetSkin(cfg.skin);
				}
			}
			else
				hpEffect = s._scene.createBarObj(s._owner, RoleType.BAR_OBJ, objID, 0, s._owner._headJumpH, 0, 0);
			
			if (!s._owner._visible)
				hpEffect.setVisible(s._owner._visible);
            s._effect = hpEffect;
        }        
    }
}